package com.design.interpreter;

/**
 * @author leali
 * @title: InterpreterClient
 * @projectName design
 * @description: InterpreterClient
 * @date 2022/1/3 18:32
 */
public class InterpreterClient {
    public static void main(String[] args) {
        String instruction = "up move 5 and down run 10 and left move 5";
        InstructionHandler handler = new InstructionHandler();
        handler.handle(instruction);
        String outString;
        outString = handler.output();
        System.out.println(outString);

        System.out.println("格式化命令测试");
        String text = "LOOP 2 PRINT 杨过 SPACE SPACE PRINT 小龙女 BREAK END PRINT 郭靖 SPACE SPACE PRINT 黄蓉";
        Context context = new Context(text);

        Node node = new ExpressionNode();
        node.interpret(context);
        node.execute();
    }
}
